import Vue from 'vue'
import Router from 'vue-router'

import Layout from '../components/Layout/Layout.vue'
import Movie from '../views/movie/movie'
import MovieDetail from '../views/movie/detail'
import LoginView from '../views/LoginView'
import RegisterView from '../views/RegisterView'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      component: Layout,
      redirect: '/movie'
    },
    {
      path: '/movie',
      name: '',
      redirect: '/movie/index',
      component: Layout,
      children: [
        {
          path: 'index',
          name: 'Movie',
          component: Movie
        },
        {
          path: 'detail',
          name: 'MovieDetail',
          component: MovieDetail
        }
      ]
    },
    {
      path: '/login',
      name: 'LoginView',
      component: LoginView
    },
    {
      path: '/register',
      name: 'RegisterView',
      component: RegisterView
    },
    {
      path: '*',
      redirect: '/pages/'
    }
  ]
})
